A map of the two kinds of value almost every game is built from - numbers you calculate with and text you show - and which page covers which.
Almost everything in a game is one of two kinds of value.
SCORE. You join it, cut it up and search it. You cannot do sums with it.Text has a technical name, string, short for "a string of characters". This manual uses both words, and they mean the same thing.
The two look alike and are not the same. 10 is a number, and you can add to it. "10" in quotation marks is text: the character 1 followed by the character 0. Adding "10" and "5" gives "105".
| You want to | Read | The short version |
|---|---|---|
| Do arithmetic, round something, or find the distance between two things | Numbers | There are two kinds of number, whole and fractional. Which one you have changes what a division gives you. |
| Show a name, a line of dialogue or a score | Text | Text is a row of characters with a length limit you choose. GBML can join, cut, search and change it. |
Both pages start from nothing. Read Numbers first if you are not sure which to begin with, because text often has a number inside it, such as a score.
To show a number on the screen you turn it into text, and to do sums on something that is written as text you turn it into a number. Two functions do it:
string turns a number into text.string_to_number turns text into a number.A quicker way to put a number inside a sentence is a template string: text with a $ in front of the quotes and values in curly brackets, like $"SCORE {score}". The Text page shows how it works.
Beyond the Numbers page, the rest of this section is one page per function. Some round a number, some keep it between two limits, some turn an angle into a direction, and some roll a random number. Each page says what goes in and what comes out. The search box at the top of the manual finds them by name.